package com.sheep.Pattern.Builder.director;

import com.sheep.Pattern.Builder.builder.ComputerBuilder;
import com.sheep.Pattern.Builder.product.Computer;

/**
 * 指挥者
 *  1. 指挥者类中包含一个Builder对象
 *  2. 指挥者类中包含一个constructComputer()方法
 *  3. constructComputer()方法中调用Builder对象的方法
 *  4. constructComputer()方法中返回Builder对象的getComputer()方法
 */
public class Director {
    private final ComputerBuilder computerBuilder;

    public Director(ComputerBuilder computerBuilder) {
        this.computerBuilder = computerBuilder;
    }

    public Computer constructComputer(){
        computerBuilder.setCpu();
        computerBuilder.setMemory();
        computerBuilder.setDisk();
        return computerBuilder.getComputer();
    }
}
